<?php

class Peter_Plugin_Profiling extends Zend_Controller_Plugin_Abstract
{
    protected $_data = null;

	public function getProfilingData()
	{
		return $this->_data;
	}
	
    public function __construct()
    {
		$this->_data = array();
        $this->_data['profilingInit'] = microtime(true);
    }
	
	public function routeStartup(Zend_Controller_Request_Abstract $request)
	{
		$this->_data['routeStartup'] = microtime(true);
	}
	
	public function routeShutdown(Zend_Controller_Request_Abstract $request)
	{
		$this->_data['routeShutdown'] = microtime(true);
	}

	public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
	{
		$this->_data['dispatchLoopStartup'] = microtime(true);
	}

	public function preDispatch(Zend_Controller_Request_Abstract $request)
	{
		$this->_data['preDispatch'][] = microtime(true);
	}
	

	public function postDispatch(Zend_Controller_Request_Abstract $request)
	{
		$this->_data['postDispatch'][] = microtime(true);
	}
	
	public function dispatchLoopShutdown()
	{
		$this->_data['dispatchLoopShutdown'] = microtime(true);
	}
}
